#define  _CRT_SECURE_NO_WARNINGS
class Solution {
public:
    vector<int> searchRange(vector<int>& nums, int target) {
        vector<int> v{ -1, -1 };
        if (nums.size() == 0)return v;
        int left = 0, right = nums.size() - 1;
        while (left < right)
        {
            int mid = left + right >> 1;
            if (nums[mid] < target) left = mid + 1;
            else right = mid;
        }
        if (nums[right] == target)v[0] = right;
        left = 0, right = nums.size() - 1;
        while (left < right)
        {
            int mid = left + right + 1 >> 1;
            if (nums[mid] <= target) left = mid;
            else right = mid - 1;
        }
        if (nums[right] == target)v[1] = right;
        return v;
    }
};